<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
		<style>
			.box {
				background-color: orange;
			}
		</style>
	</head>
	<body>
		<div class="box">
			<button>删除</button>
			<button>新增</button>
			<button>搜索</button>
		</div>

		<script>
			// 方式一: 监听的本事就是button元素
			/* var btnsEl = document.querySelectorAll('button')
			for (var btn of btnsEl) {
				btn.onmouseenter = function (e) {
					console.log(e.target.textContent)
				}
			} */

			// 方式二: 事件委托
			var boxEl = document.querySelector('.box')
			boxEl.addEventListener('mouseover', function (e) {
				if (e.target.tagName === 'BUTTON') {
					console.log('e.target', e.target.textContent)
				}
			})
		</script>
	</body>
</html>
